<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<style>

    .box{
        position: relative;
        perspective: 500px;
        /* preserve-3d  子元素开启立体空间 
           flat  子元素不开启立体空间 
           （很重要）*/
        transform-style: preserve-3d;
        width: 200px;
        height: 300px;
        margin: 100px auto;

    }
    .box div{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    .box:hover{
      transform: rotateY(45deg);
    
    }
    .div1{
        background-color: pink;
        /* z-index: 1; */
        transform: rotateX(70deg);

    }
    .div2{
        background-color: rgb(51, 190, 68);
    }
</style>
</head>

<body>
    <div class="box">
        <div class="div1"></div>
        <div class="div2"></div>
    </div>

</body>

</html>